/*   1:    */ package com.jetbrains.licenseServer.openapi.util;
/*   2:    */ 
/*   3:    */ class IntHashMap
/*   4:    */ {
/*   5:    */   private transient Entry[] a;
/*   6:    */   private transient int b;
/*   7:    */   private int c;
/*   8:    */   private float d;
/*   9:    */   
/*  10:    */   private static class Entry
/*  11:    */   {
/*  12:    */     int hash;
/*  13:    */     int key;
/*  14:    */     Object value;
/*  15:    */     Entry next;
/*  16:    */     
/*  17:    */     protected Entry(int paramInt1, int paramInt2, Object paramObject, Entry paramEntry)
/*  18:    */     {
/*  19: 64 */       this.hash = paramInt1;
/*  20: 65 */       this.key = paramInt2;
/*  21: 66 */       this.value = paramObject;
/*  22: 67 */       this.next = paramEntry;
/*  23:    */     }
/*  24:    */   }
/*  25:    */   
/*  26:    */   public IntHashMap()
/*  27:    */   {
/*  28: 76 */     this(20, 0.75F);
/*  29:    */   }
/*  30:    */   
/*  31:    */   public IntHashMap(int paramInt)
/*  32:    */   {
/*  33: 88 */     this(paramInt, 0.75F);
/*  34:    */   }
/*  35:    */   
/*  36:    */   public IntHashMap(int paramInt, float paramFloat)
/*  37:    */   {
/*  38:102 */     if (paramInt < 0) {
/*  39:103 */       throw new IllegalArgumentException("Illegal Capacity: " + paramInt);
/*  40:    */     }
/*  41:105 */     if (paramFloat <= 0.0F) {
/*  42:106 */       throw new IllegalArgumentException("Illegal Load: " + paramFloat);
/*  43:    */     }
/*  44:108 */     if (paramInt == 0) {
/*  45:109 */       paramInt = 1;
/*  46:    */     }
/*  47:112 */     this.d = paramFloat;
/*  48:113 */     this.a = new Entry[paramInt];
/*  49:114 */     this.c = ((int)(paramInt * paramFloat));
/*  50:    */   }
/*  51:    */   
/*  52:    */   public int size()
/*  53:    */   {
/*  54:123 */     return this.b;
/*  55:    */   }
/*  56:    */   
/*  57:    */   public boolean isEmpty()
/*  58:    */   {
/*  59:133 */     return this.b == 0;
/*  60:    */   }
/*  61:    */   
/*  62:    */   public boolean contains(Object paramObject)
/*  63:    */   {
/*  64:155 */     if (paramObject == null) {
/*  65:156 */       throw new NullPointerException();
/*  66:    */     }
/*  67:159 */     Entry[] arrayOfEntry = this.a;
/*  68:160 */     for (int i = arrayOfEntry.length; i-- > 0;) {
/*  69:161 */       for (Entry localEntry = arrayOfEntry[i]; localEntry != null; localEntry = localEntry.next) {
/*  70:162 */         if (localEntry.value.equals(paramObject)) {
/*  71:163 */           return true;
/*  72:    */         }
/*  73:    */       }
/*  74:    */     }
/*  75:167 */     return false;
/*  76:    */   }
/*  77:    */   
/*  78:    */   public boolean containsValue(Object paramObject)
/*  79:    */   {
/*  80:183 */     return contains(paramObject);
/*  81:    */   }
/*  82:    */   
/*  83:    */   public boolean containsKey(int paramInt)
/*  84:    */   {
/*  85:196 */     Entry[] arrayOfEntry = this.a;
/*  86:197 */     int i = paramInt;
/*  87:198 */     int j = (i & 0x7FFFFFFF) % arrayOfEntry.length;
/*  88:199 */     for (Entry localEntry = arrayOfEntry[j]; localEntry != null; localEntry = localEntry.next) {
/*  89:200 */       if (localEntry.hash == i) {
/*  90:201 */         return true;
/*  91:    */       }
/*  92:    */     }
/*  93:204 */     return false;
/*  94:    */   }
/*  95:    */   
/*  96:    */   public Object get(int paramInt)
/*  97:    */   {
/*  98:217 */     Entry[] arrayOfEntry = this.a;
/*  99:218 */     int i = paramInt;
/* 100:219 */     int j = (i & 0x7FFFFFFF) % arrayOfEntry.length;
/* 101:220 */     for (Entry localEntry = arrayOfEntry[j]; localEntry != null; localEntry = localEntry.next) {
/* 102:221 */       if (localEntry.hash == i) {
/* 103:222 */         return localEntry.value;
/* 104:    */       }
/* 105:    */     }
/* 106:225 */     return null;
/* 107:    */   }
/* 108:    */   
/* 109:    */   protected void rehash()
/* 110:    */   {
/* 111:238 */     int i = this.a.length;
/* 112:239 */     Entry[] arrayOfEntry1 = this.a;
/* 113:    */     
/* 114:241 */     int j = i * 2 + 1;
/* 115:242 */     Entry[] arrayOfEntry2 = new Entry[j];
/* 116:    */     
/* 117:244 */     this.c = ((int)(j * this.d));
/* 118:245 */     this.a = arrayOfEntry2;
/* 119:247 */     for (int k = i; k-- > 0;) {
/* 120:248 */       for (localEntry1 = arrayOfEntry1[k]; localEntry1 != null;)
/* 121:    */       {
/* 122:249 */         Entry localEntry2 = localEntry1;
/* 123:250 */         localEntry1 = localEntry1.next;
/* 124:    */         
/* 125:252 */         int m = (localEntry2.hash & 0x7FFFFFFF) % j;
/* 126:253 */         localEntry2.next = arrayOfEntry2[m];
/* 127:254 */         arrayOfEntry2[m] = localEntry2;
/* 128:    */       }
/* 129:    */     }
/* 130:    */     Entry localEntry1;
/* 131:    */   }
/* 132:    */   
/* 133:    */   public Object put(int paramInt, Object paramObject)
/* 134:    */   {
/* 135:276 */     Entry[] arrayOfEntry = this.a;
/* 136:277 */     int i = paramInt;
/* 137:278 */     int j = (i & 0x7FFFFFFF) % arrayOfEntry.length;
/* 138:279 */     for (Entry localEntry = arrayOfEntry[j]; localEntry != null; localEntry = localEntry.next) {
/* 139:280 */       if (localEntry.hash == i)
/* 140:    */       {
/* 141:281 */         Object localObject = localEntry.value;
/* 142:282 */         localEntry.value = paramObject;
/* 143:283 */         return localObject;
/* 144:    */       }
/* 145:    */     }
/* 146:287 */     if (this.b >= this.c)
/* 147:    */     {
/* 148:289 */       rehash();
/* 149:    */       
/* 150:291 */       arrayOfEntry = this.a;
/* 151:292 */       j = (i & 0x7FFFFFFF) % arrayOfEntry.length;
/* 152:    */     }
/* 153:296 */     localEntry = new Entry(i, paramInt, paramObject, arrayOfEntry[j]);
/* 154:297 */     arrayOfEntry[j] = localEntry;
/* 155:298 */     this.b += 1;
/* 156:299 */     return null;
/* 157:    */   }
/* 158:    */   
/* 159:    */   public Object remove(int paramInt)
/* 160:    */   {
/* 161:314 */     Entry[] arrayOfEntry = this.a;
/* 162:315 */     int i = paramInt;
/* 163:316 */     int j = (i & 0x7FFFFFFF) % arrayOfEntry.length;
/* 164:317 */     Entry localEntry1 = arrayOfEntry[j];
/* 165:317 */     for (Entry localEntry2 = null; localEntry1 != null; localEntry1 = localEntry1.next)
/* 166:    */     {
/* 167:318 */       if (localEntry1.hash == i)
/* 168:    */       {
/* 169:319 */         if (localEntry2 != null) {
/* 170:320 */           localEntry2.next = localEntry1.next;
/* 171:    */         } else {
/* 172:322 */           arrayOfEntry[j] = localEntry1.next;
/* 173:    */         }
/* 174:324 */         this.b -= 1;
/* 175:325 */         Object localObject = localEntry1.value;
/* 176:326 */         localEntry1.value = null;
/* 177:327 */         return localObject;
/* 178:    */       }
/* 179:317 */       localEntry2 = localEntry1;
/* 180:    */     }
/* 181:330 */     return null;
/* 182:    */   }
/* 183:    */   
/* 184:    */   public synchronized void clear()
/* 185:    */   {
/* 186:337 */     Entry[] arrayOfEntry = this.a;
/* 187:338 */     int i = arrayOfEntry.length;
/* 188:    */     for (;;)
/* 189:    */     {
/* 190:338 */       i--;
/* 191:338 */       if (i < 0) {
/* 192:    */         break;
/* 193:    */       }
/* 194:339 */       arrayOfEntry[i] = null;
/* 195:    */     }
/* 196:341 */     this.b = 0;
/* 197:    */   }
/* 198:    */ }


/* Location:           E:\idea\
 * Qualified Name:     com.jetbrains.licenseServer.openapi.util.IntHashMap
 * JD-Core Version:    0.7.0.1
 */